import request from '@/utils/request'

// 更新项目状态
export function updateApprovalResult(data) {
  return request({
    url: `/fmea/common/approve/updateApprovalResult`,
    method: 'get',
    params: data
  })
}

// 查询项目节点
export function getNexNode(query) {
  return request({
    url: `/fmea/common/approve/getNexNode`,
    method: 'get',
    params: query
  })
}

// 发起审批
export function initiateApproval(data) {
  return request({
    url: `/fmea/common/approve/initiateApproval`,
    method: 'post',
    data: data
  })
}

// 查询代办
export function upcoming(data) {
  return request({
    url: `/fmea/common/approve/upcoming`,
    method: 'get',
    params: data
  })
}

// 处理审批
export function processApproval(data) {
  return request({
    url: `/fmea/common/approve/processApproval`,
    method: 'post',
    data: data
  })
}

// 查询代办详情
export function toDoDetails(data) {
  return request({
    url: `/fmea/common/approve/toDoDetails`,
    method: 'get',
    params: data
  })
}

// 查询待处理任务
export function pendingTasks(data) {
  return request({
    url: `/fmea/common/approve/pendingTasks`,
    method: 'get',
    params: data
  })
}

// 查询待处理任务数量
export function pendingTasksCount(data) {
  return request({
    url: `/fmea/common/approve/pendingTasksCount`,
    method: 'get',
    params: data
  })
}

// 根据业务id获取审批人
export function getApprover(query) {
  return request({
    url: '/fmea/common/approve/businessKeyProcess',
    method: 'get',
    params: query
  })
}

// 项目知识库校验
export function checkProjectKnow(projectId) {
  return request({
    url: `/fmea/common/approve/projectKnowledgeCheck?projectId=${projectId}`,
    method: 'get'
  })
}

// 关系校验
export function checkRelation(projectId) {
  return request({
    url: `/fmea/common/approve/relationCheck?projectId=${projectId}`,
    method: 'get'
  })
}

// 项目知识库草稿数据
export function projectKnowDraft(projectId) {
  return request({
    url: `/fmea/common/approve/projectKnowledgeDraftDate?projectId=${projectId}`,
    method: 'get'
  })
}

// 根据项目ID查询审批进度
export function getApprovalProgress(query) {
  return request({
    url: '/fmea/common/approve/approvalProgress',
    method: 'get',
    params: query
  })
}
